Release 10.1A: OpenEdge Development:
ADM Reference


calltable.p

The calltable.p procedure allows invocation of a call by passing in a temp-table that contains the parameter values for each parameter. The temp-table must be in one of the forms supported in the calltables.i file located in the src/adm2/ directory, or from the signature of the procedure or function being invoked.

For more information, see the "Temp-table include files" section and the "Temp-table types" section.

The code in Example A–3 illustrates using calltable.p to invoke a call.

Example A–3: Using calltable.p to invoke a call 
DEFINE VARIABLE hTT AS HANDLE NO-UNDO. 
/* Include the temp-table definition */ 
{src/adm2/calltables.i 
 &PARAM-TABLE-TYPE = "1" 
 &PARAM-TABLE-NAME = "ttCallParam"} 
/* Create the parameter values into the parameter value table */ 
  CREATE ttCallParam. 
  ASSIGN 
    ttCallParam.iParamNo   = 1 
    ttCallParam.cDataType  = "CHARACTER" 
    ttCallParam.cIOMode    = "INPUT" 
    ttCallParam.cCharacter = "aaa" 
  . 
  CREATE ttCallParam. 
  ASSIGN 
    ttCallParam.iParamNo   = 2 
    ttCallParam.cDataType  = "INTEGER" 
    ttCallParam.cIOMode    = "INPUT-OUTPUT" 
    ttCallParam.iInteger   = 12 
  . 
  CREATE ttCallParam. 
  ASSIGN 
    ttCallParam.iParamNo   = 3 
    ttCallParam.cDataType  = "HANDLE" 
    ttCallParam.cIOMode    = "OUTPUT" 
    ttCallParam.hHandle    = ? 
  . 
RUN adm2/calltable.p 
  ("emptyProcParam",      /* procedure to call */ 
   "calls.p",             /* containing procedure file */ 
   INPUT TEMP-TABLE ttCallParam:HANDLE,/* Handle of temp-table */ 
   INPUT-OUTPUT TABLE-HANDLE hTT).  /* unknown - no table handle */ 

After the call completes, the return values are available in output parameter records. In Example A–3, records 2 and 3 contain the output parameters from the call.

In addition, two extra records are appended to the table. The field cParamName on these fields is set to callReturnValue and errReturnValue. The callReturnValue field contains the value of the return value from the function or procedures and the errReturnValue field contains a value if an error condition occurs.

The code in Example A–4 illustrates using calltable.p with additional requirements for mappings. The difference between Example A–3 and Example A–4 is that the API is now forced to instantiate calls.p and obtain the signature to emptyProcParam to complete the mapping of values from ttCallParam to the values in the procedure. This is more expensive in terms of performance, but does however provide some options for specifying parameters.

As in Example A–3, the code in Example A–4 appends two extra records to the table after execution of the call. The field cParamName on these fields is set to callReturnValue and errReturnValue. The callReturnValue field contains the value of the return value from the function or procedure, and the errReturnValue field contains a value if an error condition occurs.

Example A–4: Using calltable.p to invoke a call and to instantiate calls.p 
DEFINE VARIABLE hTT AS HANDLE NO-UNDO. 
/* Include the temp-table definition */ 
{src/adm2/calltables.i 
 &PARAM-TABLE-TYPE = "4" 
 &PARAM-TABLE-NAME = "ttCallParam"} 
/* Create the parameter values into the parameter value table */ 
  CREATE ttCallParam. 
  ASSIGN 
    ttCallParam.cParamName   = "pcChar" 
    ttCallParam.cValue       = "aaa" 
  . 
  CREATE ttCallParam. 
  ASSIGN 
    ttCallParam.cParamName   = "piInt" 
    ttCallParam.cValue       = "12" 
  . 
  CREATE ttCallParam. 
  ASSIGN 
    ttCallParam.cParamName   = "phHndl" 
    ttCallParam.cValue       = ? 
  . 
RUN adm2/calltable.p 
  ("emptyProcParam",      /* procedure to call */ 
   "calls.p",             /* containing procedure file */ 
   INPUT TEMP-TABLE ttCallParam:HANDLE,/* Handle of temp-table */ 
   INPUT-OUTPUT TABLE-HANDLE hTT).  /* unknown - no table handle */ 


Copyright © 2005 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095